package annotation;

import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class TakingClassInfo {
    public static void main(String[] args) {
        Class<Student> studentClass = Student.class;
        try {
//            Constructor<Student> declaredConstructor = studentClass.getDeclaredConstructor(String.class,
//                    Integer.class,Integer.class);
//            Student s = declaredConstructor.newInstance("李华", 1,1);
//            System.out.println(s.toString());
            Constructor<Student> declaredConstructor = studentClass.getDeclaredConstructor(null);
            Student student = declaredConstructor.newInstance(null);
            declaredConstructor.setAccessible(true);
            student.setId(1);
            student.setName("张三");
            student.setAge(18);
            System.out.println(student);
        }catch (Exception e){
            e.printStackTrace();
        }

    }
}
